import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);
export default new Router({
    routes: [
        { path: '/', component: resolve => require(['../components/page/Router.vue'], resolve) },
        { path: '/login', component: resolve => require(['../components/page/Login.vue'], resolve) },
        {
            path: '/boss',
            redirect: '/project',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: { title: '总部菜单' },
            children: [{
                    path: '/charts',
                    component: resolve => require(['../components/page/BaseCharts.vue'], resolve),
                    meta: { title: 'Charts图表' }
                }, {
                    path: '/discount',
                    component: resolve => require(['../views/home/discount.vue'], resolve),
                    meta: { title: '优惠福利' }
                },
                {
                    path: '/project',
                    component: resolve => require(['../views/project/index.vue'], resolve),
                    meta: { title: '项目管理' }
                },
                {
                    path: '/projectHot',
                    component: resolve => require(['../views/project/hot.vue'], resolve),
                    meta: { title: '热门项目' }
                },
                {
                    path: '/projectAdd',
                    component: resolve => require(['../views/project/add.vue'], resolve),
                    meta: { title: '新增项目' }
                },
                {
                    path: '/projectClassify',
                    component: resolve => require(['../views/project/classify.vue'], resolve),
                    meta: { title: '项目分类维护' }
                },
                {
                    path: '/project/detail/:id',
                    component: resolve => require(['../views/project/details.vue'], resolve),
                    meta: { title: '查看项目' }
                },
                {
                    path: '/project/edit/:id',
                    component: resolve => require(['../views/project/edit.vue'], resolve),
                    meta: { title: '编辑项目' }
                },
                {
                    path: '/coupon',
                    component: resolve => require(['../views/coupon/index.vue'], resolve),
                    meta: { title: '优惠券管理' }
                },
                {
                    path: '/coupon/add',
                    component: resolve => require(['../views/coupon/add.vue'], resolve),
                    meta: { title: '发布优惠券' }
                },
                {
                    path: '/coupon/edit',
                    component: resolve => require(['../views/coupon/edit.vue'], resolve),
                    meta: { title: '编辑优惠券' }
                },
                {
                    path: '/agree',
                    component: resolve => require(['../views/agree/list.vue'], resolve),
                    meta: { title: '普通预约' }
                },
                {
                    path: '/goods',
                    component: resolve => require(['../views/goods/list.vue'], resolve),
                    meta: { title: '商品管理' }
                },
                {
                    path: '/goods/add',
                    component: resolve => require(['../views/goods/add.vue'], resolve),
                    meta: { title: '新增商品' }
                },
                {
                    path: '/goods/edit/:goodsId',
                    component: resolve => require(['../views/goods/edit.vue'], resolve),
                    meta: { title: '编辑商品' }
                },
                {
                    path: '/goods/select/:goodsId',
                    component: resolve => require(['../views/goods/select.vue'], resolve),
                    meta: { title: '查看商品' }
                },
                {
                    path: '/goods/hot',
                    component: resolve => require(['../views/goods/hot.vue'], resolve),
                    meta: { title: '爆款商品' }
                },
                {
                    path: '/goods/classify',
                    component: resolve => require(['../views/goods/classify.vue'], resolve),
                    meta: { title: '商品分类' }
                },
                {
                    // 首页轮播图管理
                    path: '/swiper',
                    component: resolve => require(['../views/home/slide.vue'], resolve),
                    meta: { title: '首页轮播图管理' }
                },
                {
                    path: '/marketSlide',
                    component: resolve => require(['../views/home/marketSlide.vue'], resolve),
                    meta: { title: '商城轮播图管理' }
                },
                {
                    // 关于我们
                    path: '/about',
                    component: resolve => require(['../views/home/about.vue'], resolve),
                    meta: { title: '关于我们' }
                },
                {
                    // 门店列表
                    path: '/store',
                    component: resolve => require(['../views/store/storeList.vue'], resolve),
                    meta: { title: '门店列表' }
                },
                {
                    path: '/store/select/:id',
                    component: resolve => require(['../views/store/storeDetails.vue'], resolve),
                    meta: { title: '门店详情' }
                },
                {
                    path: '/store/edit/:id',
                    component: resolve => require(['../views/store/editStore.vue'], resolve),
                    meta: { title: '门店编辑' }
                },

                {
                    // 关于我们
                    path: '/store/add',
                    component: resolve => require(['../views/store/addStore.vue'], resolve),
                    meta: { title: '新增门店' }
                },
                {
                    // 关于我们
                    path: '/store/edit',
                    component: resolve => require(['../views/store/editStore.vue'], resolve),
                    meta: { title: '编辑门店' }
                },
                {
                    // 门店账号
                    path: '/store/account',
                    component: resolve => require(['../views/store/storeAccount.vue'], resolve),
                    meta: { title: '门店账号' }
                },
                {
                    // 新增门店账号
                    path: '/store/account/add',
                    component: resolve => require(['../views/store/addAccount.vue'], resolve),
                    meta: { title: '新增账号' }
                },
                {
                    // 会员管理
                    path: '/member',
                    component: resolve => require(['../views/member/member.vue'], resolve),
                    meta: { title: '会员管理' }
                },
                {
                    // 订单管理
                    path: '/order',
                    component: resolve => require(['../views/order/index.vue'], resolve),
                    meta: { title: '订单管理' }
                },
                {
                    //拼团预约
                    path: '/spell',
                    component: resolve => require(['../views/agree/spellOrder.vue'], resolve),
                    meta: { title: '拼团预约' }
                },
                {
                    // 查看订单
                    path: '/order/detail/:id',
                    component: resolve => require(['../views/order/info.vue'], resolve),
                    meta: { title: '查看订单' }
                },
                {
                    // 填写物流信息
                    path: '/order/sendgoods/:id',
                    component: resolve => require(['../views/order/sendGoods.vue'], resolve),
                    meta: { title: '填写物流信息' }
                },
                {
                    // 财务管理
                    path: '/finance',
                    component: resolve => require(['../views/finance/finance.vue'], resolve),
                    meta: { title: '财务管理' }
                },
                {
                    //门店销售额
                    path: '/finance/store',
                    component: resolve => require(['../views/finance/financeStore.vue'], resolve),
                    meta: { title: '门店销售额' }
                },
                {
                    // 财务管理
                    path: '/appraise',
                    component: resolve => require(['../views/appraise/list.vue'], resolve),
                    meta: { title: '评价管理' }
                }
            ]
        },
        {
            path: '/staff',
            redirect: '/branch/agree',
            component: resolve => require(['../components/common/Home.vue'], resolve),
            meta: { title: '门店菜单' },
            children: [{
                    path: '/branch/project',
                    component: resolve => require(['../views/branch/project/list.vue'], resolve),
                    meta: { title: '门店项目管理' }
                },
                {
                    path: '/branch/finance',
                    component: resolve => require(['../views/branch/finance/list.vue'], resolve),
                    meta: { title: '门店财务管理' }
                },
                {
                    path: '/branch/price',
                    component: resolve => require(['../views/branch/price/list.vue'], resolve),
                    meta: { title: '项目申请列表' }
                },
                {
                    path: '/branch/agree',
                    component: resolve => require(['../views/branch/agree/list.vue'], resolve),
                    meta: { title: '普通项目预约管理' }
                },
                {
                    path: '/branch/agree2',
                    component: resolve => require(['../views/branch/agree/list2.vue'], resolve),
                    meta: { title: '拼团项目预约管理' }
                }
            ]
        },
        { path: '/404', component: resolve => require(['../components/page/404.vue'], resolve) },
        { path: '/403', component: resolve => require(['../components/page/403.vue'], resolve) },
        { path: '*', redirect: '/404' }
    ]
})